<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of textureMap</title>
  <meta name="keywords" content="textureMap">
  <meta name="description" content="Maps texture in I according to rsDst and csDst.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html images -->
<h1>textureMap
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Maps texture in I according to rsDst and csDst.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [J,boundX,boundY] = textureMap( I, rsDst, csDst, bbox, fillVal ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Maps texture in I according to rsDst and csDst.

 I has (nrows*ncols) coordinates.  Each coordinate has an associated
 intensity value.  A transformation on I can be defined by giving the
 destination (r',c') of the intensity associated with coordinate (r,c) in
 I -- ie I(r,c).  Applying the transformation, we ask what intensity is
 associated with a coordinate (r0',c0') by interpolating between the
 intensities at the closest coordinates (r',c').  In the function below
 specify the destination of (r,c) by (rsDst(r,c), csDst(r,c)).

 If the inverse mapping is also available -- ie, if we can go from the
 coordinates in the destination to the coordinates in the source, then a
 much more efficient procedure can be used to textureMap that involves
 interp2 instead of griddata. Use imtransform2 for this case.

 The bounding box of the image is set by the BBOX argument, a string that
 can be 'loose' (default) or 'crop'. When BBOX is 'loose', J includes the
 whole transformed image, which generally is larger than I. When BBOX is
 'crop' J is cropped to include only the central portion of the
 transformed image and is the same size as I.

 USAGE
  J = textureMap( I, rsDst, csDst, [bbox], [fillVal] )

 INPUTS
  I           - 2D input image
  rsDst       - rsDst(i,j) is row loc where I(i,j) gets mapped to
  csDst       - csDst(i,j) is col loc where I(i,j) gets mapped to
  bbox        - ['loose'] see above for meaning of bbox 'loose' or 'crop'
  fillVal     - [0] Value of the empty warps

 OUTPUTS
  J           - result of texture mapping
  boundaryX   - returns the smallest/biggest x coordinate of the output
  boundaryY   - returns the smallest/biggest y coordinate of the output

 EXAMPLE
  load trees; I=X; angle=55; R=rotationMatrix(-angle/180*pi);
  m=size(I,1); n=size(I,2); m2=(m+1)/2; n2=(n+1)/2;
  [cs,rs]=meshgrid(1:n,1:m); vs=R*[cs(:)-n2 rs(:)-m2]';
  tic; J1 = imrotate(I,angle,'bilinear','crop'); toc
  tic, J2 = textureMap(I,vs(2,:)+m2,vs(1,:)+n2,'crop',nan); toc
  figure(1); clf; subplot(2,2,1); im(I); subplot(2,2,2); im(J1-J2);
  subplot(2,2,3); im(J1); subplot(2,2,4); im(J2);

 See also <a href="imtransform2.html" class="code" title="function J = imtransform2( I, H, varargin )">IMTRANSFORM2</a>

 Piotr's Computer Vision Matlab Toolbox      Version 2.61
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]</pre></div>





<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
